﻿using System;

namespace Kay.Communication.Framework.Custom_EventArgs
{
    /// <summary>
    /// 为进度改变事件提供数据
    /// </summary>
    public class ProgressIsChangedEventArgs : EventArgs
    {
        /// <summary>
        /// 初始化进度改变事件的数据
        /// </summary>
        /// <param name="prg">当前进度，以百分比计算</param>
        /// <param name="info">发送者 Id</param>
        /// <exception cref="ArgumentNullException">当 Id 为 NULL 时将引发此异常</exception>
        /// <exception cref="ArgumentOutOfRangeException">进度不在 0 ~ 100 之间时将引发此异常</exception>
        public ProgressIsChangedEventArgs(int prg, TransferFileInfo info)
        {
            if (info == null) throw new ArgumentNullException("info");
            if (prg < 0 || prg > 100) throw new ArgumentOutOfRangeException("prg");

            Progress = prg;
            Project = info;
        }

        /// <summary>
        /// 进度的百分比
        /// </summary>
        public int Progress { get; set; }

        /// <summary>
        /// 项目的 Id
        /// <para>默认指发送者 Id</para>
        /// </summary>
        public TransferFileInfo Project { get; set; }
    }
}